{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "AB test "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "  \"meta\": {\n",
      "    \"puid\": \"5hihcaj80938829kpsbfahvkot\",\n",
      "    \"tags\": {\n",
      "    },\n",
      "    \"routing\": {\n",
      "      \"random-ab-test\": 0\n",
      "    }\n",
      "  },\n",
      "  \"data\": {\n",
      "    \"names\": [],\n",
      "    \"ndarray\": [2.0]\n",
      "  }\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "import requests, json, numpy as np\n",
    "from requests.auth import HTTPBasicAuth\n",
    "DEPLOY_NAME = 'seldon-deployment-abtest'\n",
    "\n",
    "headers = {\"Content-type\": \"application/json\"}\n",
    "data='{\"data\":{\"ndarray\":[[5.9, 3.0, 5.1, 1.8]]}}'\n",
    "url = 'http://localhost:8001/api/v1/namespaces/mdt/services/{}:8000/proxy/api/v0.1/predictions'.format(DEPLOY_NAME)\n",
    "resp = requests.post(url, headers=headers, data=data, auth=HTTPBasicAuth('oauth-key', 'oauth-secret'))\n",
    "print(resp.text)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
